﻿namespace Helpers.Common
{
    public class InvalidPropertyResponse<DataType> : ResponseMessageTemplate<DataType>
    {
        #region Properties

        private string propertyName;
        public string PropertyName
        {
            get { return this.propertyName; }
            protected set
            {
                this.propertyName = value;

                this.UpdateMessage();
            }
        }

        #endregion

        #region Static Properties

        private const string DEFAULT_MSG_TEMPLATE = "The property '{0}' is not valid.";

        #endregion

        public InvalidPropertyResponse(string propertyName)
            : this(propertyName, DEFAULT_MSG_TEMPLATE) { }
        public InvalidPropertyResponse(string propertyName, string messageTemplate)
            : base(messageTemplate)
        {
            this.PropertyName = propertyName;
        }

        #region Methods

        protected override void UpdateMessage()
        {
            this.UpdateMessage(this.PropertyName);
        }

        #endregion
    }

    public class InvalidPropertyResponse : ResponseMessageTemplate
    {
        #region Properties

        private string propertyName;
        public string PropertyName
        {
            get { return this.propertyName; }
            protected set
            {
                this.propertyName = value;

                this.UpdateMessage();
            }
        }

        #endregion

        #region Static Properties

        private const string DEFAULT_MSG_TEMPLATE = "The property '{0}' is not valid.";

        #endregion

        public InvalidPropertyResponse(string message)
            : base(message) { }
        public InvalidPropertyResponse(string propertyName, string messageTemplate)
            : base(messageTemplate) { }

        #region Methods

        protected override void UpdateMessage()
        {
            this.UpdateMessage(this.PropertyName);
        }

        #endregion
    }
}